<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>客房编辑</title>
    <%@ include file="include/head.jsp" %>
</head>
<body>
<div class="container-fluid">
    <ul class="nav nav-tabs">
        <li><a href="RoomServlet?action=list">客房列表</a></li>
        <li class="active"><a href="#">编辑</a></li>
    </ul>
    <br/>
    <form class="form-horizontal" role="form" action="RoomServlet?action=edit" method="post" onsubmit="return check()">
        <input type="hidden" class="form-control" id="id" name="id" value="${vo.id}"/>
        
            <div class="form-group">
                <label class="col-sm-3 control-label">房间号：</label>
                <div class="col-sm-5">
                    <input type="text" class="form-control" id="roomName" name="roomName" value="${vo.roomName}">
                </div>
            </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">类型：</label>
            <div class="col-sm-5">
                       <input name="roomLevel" type="radio" value="普通" ${vo.roomLevel=='普通'?'checked':''}/>&nbsp;&nbsp;&nbsp;普通&nbsp;&nbsp;&nbsp;&nbsp;
                       <input name="roomLevel" type="radio" value="贵宾" ${vo.roomLevel=='贵宾'?'checked':''}/>&nbsp;&nbsp;&nbsp;贵宾&nbsp;&nbsp;&nbsp;&nbsp;
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">状态：</label>
            <div class="col-sm-5">
                       <input name="roomStatus" type="radio" value="空闲" ${vo.roomStatus=='空闲'?'checked':''}/>&nbsp;&nbsp;&nbsp;空闲&nbsp;&nbsp;&nbsp;&nbsp;
                       <input name="roomStatus" type="radio" value="已入住" ${vo.roomStatus=='已入住'?'checked':''}/>&nbsp;&nbsp;&nbsp;已入住&nbsp;&nbsp;&nbsp;&nbsp;
            </div>
        </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">床位数：</label>
                <div class="col-sm-5">
                    <input type="text" class="form-control" id="roomBedcount" name="roomBedcount" value="${vo.roomBedcount}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">小时价：</label>
                <div class="col-sm-5">
                    <input type="text" class="form-control" id="roomHourprice" name="roomHourprice" value="${vo.roomHourprice}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">单日价：</label>
                <div class="col-sm-5">
                    <input type="text" class="form-control" id="roomDayprice" name="roomDayprice" value="${vo.roomDayprice}">
                </div>
            </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">备注：</label>
            <div class="col-sm-5">
                <textarea rows="3" class="form-control" id="roomText" name="roomText" placeholder="请输入内容......">${vo.roomText}</textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label"></label>
            <div class="col-sm-5">
                <input type="submit" class="btn btn-pill btn-grad btn-warning btn-sm" value="保存">
                <input type="button" class="btn btn-pill btn-grad btn-warning btn-sm" value="返回" onclick="javascript:history.back(-1);">
            </div>
        </div>
    </form>
</div>
</body>
<script type="text/javascript">
    //提交之前进行检查，如果return false，则不允许提交
    function check() {
        //根据ID获取值
        if (document.getElementById("roomName").value.trim().length == 0) {
            alert("房间号不能为空!");
            return false;
        }
        if (document.getElementById("roomBedcount").value.trim().length == 0) {
            alert("床位数不能为空!");
            return false;
        }
        if (document.getElementById("roomHourprice").value.trim().length == 0) {
            alert("小时价不能为空!");
            return false;
        }
        if (document.getElementById("roomDayprice").value.trim().length == 0) {
            alert("单日价不能为空!");
            return false;
        }
        return true;
    }
</script>
</html>
